<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let year =prompt('请问您哪一年出生');
        year= parseInt(year);
        let age = 2022-year;
        alert('您的年龄是'+age+'岁')
    </script>
</body>
</html>